<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div>
    <div>文字不可以选中</div>
    <img src="" alt="图片">
  </div>
  <script>
    document.addEventListener('selectstart', (e) => {
      e.preventDefault()
    })
  </script>

</body>

</html>